package hw1;





public class CargoCompany {
	private String name;
	private String[] avaliableCities;
	private double pricePerDistance;
	private double pricePerWeight;
	private double pricePerItem;
	
	CargoCompany(String name, String[] avaliableCities, double pricePerDistance,double pricePerWeight, double pricePerItem  )
	{
		this.name=name;
		this.avaliableCities=avaliableCities;
		this.pricePerDistance=pricePerDistance;
		this.pricePerWeight=pricePerWeight;
		this.pricePerItem=pricePerItem;
	}

	public String getName() {
		return name;
	}
	
	public double calculatePrice(Shipment s){
		
		double price= pricePerDistance*s.getDistance()+  pricePerWeight*s.getWeight() + pricePerItem*s.getNumberOfItems();
		return price;
		
	}
	
	public boolean isAvailableCity(String cityName){
		for(int i=0;i < avaliableCities.length;i++)
			if(avaliableCities[i].equalsIgnoreCase(cityName))
					return true;
		return false;
	}
}